<script setup lang="ts">
import { baseToolsStore } from '@/stores/baseTools'
import { headersStore } from '@/stores/apiHeader'
import HumanTablDimission from '@/components/Echart/Table/HumanTablDimission.vue'
import { reactive, watch, computed } from 'vue'
import { storeToRefs } from 'pinia'
import { useHumanStore } from '@/stores/module/human'
const HumanStore = useHumanStore() // 创建store实例
const { getDepartureComparison } = storeToRefs(HumanStore)
const isDepartment = computed(() => baseToolsStore().isDepartment) //是否是部门
// 是否为集团总部
const isHeadquarters = computed(() => {
  return headersStore().scope_code === '0000100001'
})
const nameSuffix = getDepartureComparison.value?.info
  ?.map((item) => {
    return item.name
  })
  .join('')
const nameData = getDepartureComparison.value?.info
  ?.map((item) => {
    return item.data
  })
  .join('')
</script>
<template>
  <card-box>
    <template v-slot:title v-if="getDepartureComparison.title">
      <h1>{{ getDepartureComparison.title }}</h1>
    </template>
    <HumanTablDimission
      :performanceGrade="nameSuffix"
      :nameData="nameData"
      v-if="getDepartureComparison?.info?.length"
    />
    <div v-else class="default-img">
      <p>
        {{
          !isDepartment && !isHeadquarters ? $t('bi_common_nodata') : '暂无数据'
        }}
      </p>
    </div>
  </card-box>
</template>
<style lang="scss" scoped>
.default-img {
  width: 100%;
  text-align: center;
  padding: 120px 0;
  background-image: url('@/assets/images/canvsimage/default.png');
  background-repeat: no-repeat;
  background-position: center;

  font-size: 16px;
  color: #00f6ff;
}
</style>
